// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of luhn
//
// luhn is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// luhn is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with DOM3ImplReg. If not, see <http://www.gnu.org/licenses/>.
//	Copyright (c) 2008, Sidewinder ltd.
//
//   Purpose: checks luhn ids.
//   $Id$

//<summary>
//	Checker for luhn ids, in its default state, only decimal digits are acceptable
//</summary>
class CLuhnIDChecker
{
public:
	CLuhnIDChecker();
	virtual ~CLuhnIDChecker();
	//<summary>
	//	Tests an input for luhn accuracy
	//</summary>
	//<returns>
	//	true if id passes the luhn check
	//	false if it fails.
	//</returns>
	//<param name="id">
	//	A string of characters representing digits from 0-9.
	//</param>
	//<remarks>
	//	If an invalid character is found in id, an empty error is thrown.
	//</remarks>
	bool checkLuhnID(const wchar_t * id) const;

	//<summary>
	//	Tests an input for luhn accuracy
	//</summary>
	//<returns>
	//	true if id passes the luhn check
	//	false if it fails.
	//</returns>
	//<param name="id">
	//	A string of characters representing digits from 0-9.
	//</param>
	//<param name="l">
	//	length of id
	//</param>
	bool checkLuhnID_l(const wchar_t *id,int length) const;
	
	//<summary>
	//	Sets characters to be ignored (e.g. whitespace, hyphens)when processing a luhn id
	//</summary>
	void put_ignoreList(const wchar_t * sIgnoreList);
	//<summary>
	//	resets the characters to be ignored list to the default state.
	//</summary>
	void clear_ignoreList();
private:
	wchar_t * m_sIgnoreList;

};